package lock.lntelligence.gjx.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.aiton.administrator.shane_library.shane.ZjbBaseActivity;

import lock.lntelligence.gjx.R;
import lock.lntelligence.gjx.constant.Constant;

public class VoiceActivity extends ZjbBaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_voice);
        init();
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initViews() {

    }

    @Override
    protected void setListeners() {
        findViewById(R.id.imageView_back).setOnClickListener(this);
    }

    @Override
    protected void initSP() {

    }

    @Override
    protected void initIntent() {

    }

    @Override
    protected void findID() {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.imageView_back:
                finishTo();
                break;
        }
    }

    private boolean isSleep =false;

    @Override
    protected void onStart() {
        super.onStart();
        if (isSleep){
            Intent intent = new Intent();
            intent.setClass(VoiceActivity.this,LockActivity.class);
            intent.putExtra("sleep","sleep");
            startActivityForResultTo(intent, Constant.REQUEST_RESULT.IS_SLEEP);
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        isSleep=true;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode == Constant.REQUEST_RESULT.IS_SLEEP && resultCode == Constant.REQUEST_RESULT.IS_SLEEP){
            isSleep = false;
        }
    }
}
